package com.alibaba.yinan.domain.task.service.policy.extension;

import com.alibaba.cola.extension.Extension;
import com.alibaba.yinan.domain.task.service.policy.extensionpoint.DispatchPolicyExtPt;
import com.alibaba.yinan.domain.task.Task;
import lombok.extern.slf4j.Slf4j;

/**
 * @ClassName NearestAvailablePolicy
 * @Author mengke
 * @create 2025/8/3 22:21
 * @Description 可根据不同租户、流程、业务维度区分
 */
@Slf4j
@Extension(bizId = "task", useCase = "assign", scenario = "agv")
public class NearestAvailablePolicyExt implements DispatchPolicyExtPt {

    @Override
    public boolean support(String policyKey) {
        return "nearest".equalsIgnoreCase(policyKey);
    }

    @Override
    public String selectDevice(Task task) {
        log.info("开始执行最近可用设备分配策略，任务ID：{}", task.getId());
        return "device-123";
    }
}
